<?php
namespace Backend\Controller;
use Think\Controller;
class MainController extends BaseController
{
    public function index() {

        $data =D('Ad_order')->field('sum(amount) as amount,sum(total_amount) as total_amount')->where(array('user_id' =>$_SESSION['id']))->find();
        $data['code_count'] = D('Code')->where(array('user_id'=>$_SESSION['id']))->count();
        $data['delivery_count'] = D('AdDelivery')->where(array('user_id'=>$_SESSION['id']))->count();
        $data['order_count'] =D('AdOrder')->where(array('user_id'=>$_SESSION['id']))->count();
        $data['ad_count'] =D('Ad')->where(array('user_id'=>$_SESSION['id']))->count();

        $this->assign('data',$data);
		$this->display('index');
    }
}